package com.wuqing.consumer.service;

import com.wuqing.TpRunService;
import com.wuqing.consumer.utils.AsyncExecutor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author wuqing
 * @date 2020/8/8
 */
@Service
public class TpService {

    @Resource
    private TpRunService tpRunService;

    // @Reference(version = "${demo.service.version}",
    //     //         // application = "${dubbo.application.id}",
    //     //         // registry = "${dubbo.registry.id}",
    //     //         interfaceClass = TpRunService.class,
    //     //         check = false)
    //     // private TpRunService tpRunService;
    //     //
    //     // @Bean
    //     // public TpRunService tpRunService(){
    //     //     return tpRunService;
    //     // }

    public String sayHello(String name) {
        return tpRunService.sayHello1(name);
    }

    public String study(String name) {
        return tpRunService.study1(name);
    }

    public String run(String name) {
        return tpRunService.run1(name);
    }

    public void go(String name) {
        AsyncExecutor.run(() -> this.run(name));
        AsyncExecutor.run(() -> this.study(name));
        AsyncExecutor.run(() -> this.sayHello(name));
    }

}